<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>搜索</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../../../css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="../../../css/inspection/search.css" />
		<link rel="stylesheet" href="../../../css/inspection/common.css" />
	</head>

	<body>
		<!--主体内容-->
		<div id="search">
			<!--搜素框-->
			<div class="searchTop">
				<span class=" mui-icon mui-icon-search"></span>
    			<input v-model="message" type="text" class="mui-input-clear" placeholder="促甲状腺激素">
    			<button @click="jumpItemDetail">取消</button>
			</div>
			<!--列表-->
			<ul class="ulStyle">
			    <li @click="jumpTestDetail(item.id,item.productName)" v-for="item in messageItem">{{item.productName}}</li>
			</ul>
			<div>
				<button @click="clearItem" class="clearBtn">清除搜素记录</button>
			</div>
		</div>
		<script src="../../../js/mui.min.js"></script>
		<script src="../../../js/vue.js"></script>
		<script>
			new Vue({
				el:'#search',
				data:{
//					url:'https://lab.ulabcare.com/clinicalmall-web/',
					url1:'https://api.test.lis.ulabcare.com/api/clinic-doctor/',
					message:'',
					messageItem:{}
				},
				methods:{
					//清除数据
					clearItem:function(){
						this.messageItem="";
					},
					//按取消，跳转回项目目录界面
					jumpItemDetail:function(){
						location.href="catalogIndex.html";
					},
					//跳转到检验项目明细
					jumpTestDetail:function(id,title){
						let t= encodeURI(encodeURI(title));
						location.href="testDetail.html?id="+id+"&title="+t;
					}
				},
				watch:{
					message:function(){
						let _this=this;
						let url=_this.url1;
						console.log(url);
						mui.ajax(url+'jyzsApp/selectProjectIntroduction',{
							data:{
								productName:_this.message,
								pageSize:1000
							},
							dataType:'json',//服务器返回json格式数据
							type:'post',//HTTP请求类型
							headers:{'Content-Type':'application/json','token':localStorage.getItem(localStorage.getItem("state")+"_doctor_token")},
							success:function(res){
								//服务器返回响应，根据响应结果，分析；
								 console.log(res);
								if(res.code=="000000"){
									_this.messageItem=res.data;
								}
							},
							error:function(xhr,type,errorThrown){
								//异常处理；
								console.log(type);
							}
						});
					}
				}
			})
		</script>
	</body>

</html>